#include "GnMainPCH.h"
#include "GnStream.h"
#include <GnBinaryStream.h>
#include <GnAcsiiStream.h>
#include <GnTHelper.h>

std::map<const gchar*, GnStream::CreateFunction> GnStream::mCreateFunctions;

GnStream::GnStream(void)
{
}

GnStream::~GnStream(void)
{
}
bool GnStream::Load( const gtchar* pFileName )
{
	//GnFile::GetFile( pFileName, GnFile::READ_ACSII )
	return true;
}
bool GnStream::LoadBinaryStream( GnBinaryStream* pFile )
{
	// read list of objects
	gtuint numObjects = mObjects.GetSize();
	for ( gtuint i = 0 ; i < numObjects; i ++ )
	{
		GnStreamObjects pObject = mObjects.GetAt(i);
		//pFile->LoadStream( pObject );
	}

	return true;
}


void GnStream::RegisterLoader( const gchar* pClassName, CreateFunction pfnFunc)
{
	bool ret = THelper::Add( mCreateFunctions, pClassName, pfnFunc );
	GnAssert(ret);
}
void GnStream::UnregisterLoader(const gchar* pClassName)
{
	THelper::Remove( mCreateFunctions, pClassName );
}